package com.cyurs.netty.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

/**
 * @Author: Cyrus
 * @CreateDate: 2020/11/16
 */
public class ChannelDemo4 {
    public static void main(String[] args) throws Exception{
        FileInputStream fileInputStream = new FileInputStream("d:\\a.png");
        FileOutputStream fileOutputStream = new FileOutputStream("d:\\b.png");

        FileChannel start = fileInputStream.getChannel();
        FileChannel end = fileOutputStream.getChannel();

        end.transferFrom(start, 0, start.size());

        start.close();
        end.close();
        fileInputStream.close();
        fileOutputStream.close();
    }
}
